package com.juzipi.demo.tools;


import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class Result {


    private Boolean flag;
    private String message;
    private Integer code;
    private Object data;


    public static Result success(){
        return new Result(true,"SUCCESS!",200,null);
    }


    public static Result successData(Object data){
        return new Result(true,"SUCCESS!",200,data);
    }

    public static Result successMessageAndData(String message,Object data){
        return new Result(true,message,200,data);
    }


    public static Result successMessage(String message){
        return new Result(true,message,200,null);
    }


    public static Result fail(String message,Integer code){
        return new Result(false,message,code,null);
    }

    public static Result failData(String message,Integer code,Object data){
        return new Result(false,message,code,data);
    }


}
